import React from 'react'
import {connect} from 'react-redux'
import {addActionCreator} from '../store/actions/counterAction'
function Right(props) {
 console.log('right->props',props);
  return (
    <div style={{flex:1,height:'100vh',background:'skyblue'}}>
       <h1>{props.count}</h1>
        <button onClick={()=>{
          props.commit(addActionCreator(2))
        }}>+2</button>
    </div>
  )
}
const mapStateToProps=(state)=>{
  return{
    count:state.count
  }
}

const mapDisptchToProps=(arg)=>{
  return {
    commit:arg
  }
}
export default connect(mapStateToProps,mapDisptchToProps)(Right)
